package com.jel.WiKikonwledge.Util;
import com.arangodb.*;
import com.arangodb.entity.BaseDocument;
import com.arangodb.entity.CollectionEntity;
import org.junit.Test;
/**
 * @author curbert:jiangenlai
 * @description
 * @date 2022-05-24 18:28:25
 * @PACKAGE_NAME:com.jel.WiKikonwledge.Util
 */
public class To_Arangodb {
    private static ArangoDB arangoDB = new ArangoDB.Builder().host("127.0.0.1", 8529).user("root").password("root").build();
    //数据库
    private static ArangoDatabase db = arangoDB.db("_system");
    //集合
    private static ArangoCollection coll =db.collection("user");
    @Test
    public void insertDocument() {
        BaseDocument document = new BaseDocument();
        document.addAttribute("id",01);
        document.addAttribute("name","Damo");
        document.addAttribute("tag","10");
        coll.insertDocument(document);
    }
    public static ArangoDatabase getConnection(){
        String user = "root";
        String password = "root";
        //在这里实现对于数据库的访问，这里定义数据库的访问的库名称。
        String database = "wikidata";
        ArangoDB arangoDB = new ArangoDB.Builder().host("10.117.1.239", 8529).user(user).password(password).build();
        //数据库
        ArangoDatabase db = arangoDB.db(database);
        //集合
        return db;
    }
}
